package com.sync.syncmasterdata.usercenter.controller;

import com.sync.syncmasterdata.usercenter.service.UserServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.*;

/**
 * 用户信息层
 */
@RestController
@RequestMapping("/usercenter")
@Slf4j
public class UserCenterController {

    @Autowired
    private UserServiceImpl userService;

    /**
     * 获取oa userid
     * @param param1
     * @return
     */
    @GetMapping("/getOaUserid")
    public Map<String,Object> getOaUserid(@RequestParam(value = "param1") String param1) {
        Map<String, Object> map = new HashMap<>();
        if(StringUtils.isBlank(param1)){
            map.put("oaid", null);
            return map;
        }else{
            Integer _i = userService.getUserid(param1);
            Integer _d = userService.getDepartmentid(param1);
            map.put("oaid", _i);
            map.put("departmentid",_d);
            return map;
        }
    }
}
